package com.zj.util;

import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.security.Keys;

import java.util.Base64;

/**
 * @author zj
 * @description 生成HS256密钥
 * @create 2023-12-20
 */
public class SecretKeyGeneratorUtilsTest {
    public static void main(String[] args) {
        byte[] keyBytes= Keys.secretKeyFor(SignatureAlgorithm.HS256).getEncoded();
        //将以上的keyBytes转换为base64编码的字符串
        String key= Base64.getEncoder().encodeToString(keyBytes);
        System.out.println("HS256密钥:"+key);
    }
}
